<?php
namespace Users\Controller;

use Think\Controller;
class RegisterController extends Controller{
	private $loginService;
	private $regService;
	
	function _initialize(){
		$this->loginService = D('Login','Service');
		$this->regService = D('Reg','Service');
		
		//cookie自动登录
		$this->loginService->cookielogin();

	}
	
	//注册页面
	public function index(){
		$this->display();
	}
	
	
	//判断验证码是否正确
	public function checkinvitation(){
		$value = trim($_REQUEST['invitation']);
		if($this->regService->checkInvitation($value)){
			$data['ok'] = '';
		}else{
			$data['error'] = '邀请码错误';
		}
		$this->ajaxReturn($data,'JSON');
	}
}